#include <iostream>
using namespace std;
int main()
{
	int n,a[1000],i;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	int x,y;
	cin>>x>>y;
	int min=x>y?y:x;
	int max=x>y?x:y;
	for(i=0;i<n;i++)
		if(a[i]<min||a[i]>max)
			cout<<a[i]<<" ";
	return 0;
}